<%@page import="world.member.dao.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" 
         pageEncoding="UTF-8"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>맥주 검색</title>
<script type="text/javascript" src="/world/script/jquery.js"></script>
<script type="text/javascript" src="/world/script/heart_control.js"></script>
<link href="/world/script/goalbeer_main.css" rel="stylesheet" type="text/css">
<link href="/world/script/goalbeer_content.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
$(document).ready(function(){
	//탈퇴시 탈퇴 여부 체크
	$("#deleteCheck").on("click",function(){
		if(confirm("탈퇴 하시겠습니까?")==false){
			return false;
		}
	});


	//닉네임 중복 체크
   $("#nickName").on("focus",function(){
      $("#nickName").empty();   
   });
   
   $("#nickName").on("keyup",function(){
      $.ajax({
      type:"post",
      url:"${initParam.rootPath}/member/nickNameCheck.do",
      data:{"nickNameCheck":$("#nickName").val()},
      dataType:"json",
      beforeSend:function(){
         //var nickNameCheck = $("#nickName").val();
         
            if($("#nickName").val().length < 4){
            $("#msgNick2").html("<font color='red'>닉네임은 4자리 이상 입력하세요.</font>");
            return false; //전송 x
            
            }else{
               $("#msgNick2").html("");   
            }
            
         
      },//before
      success:function(result){
         $("#msgNick2").html("<font color='green'>"+result.message+"</font>");
      }

   });
});//on
});//ready

</script>
<style type="text/css">
#search_content{height: 500px}
#search_layer{margin-bottom: 30px;}
h3{font-size:22px;color:DarkSlateGray;}
#search{width: 250px;  height: 25px;  font-size: 15px;  color: gray; border-color:DodgerBlue;}
#search_btn{	height: 30px;  cursor: pointer;}
#beer_list_all, #beer_list_all_forLogin{margin:30px;align:center;font-size:14px;font-weight:bold;text-align:center;}
#beer_name{color:DarkSlateGray;font-size:16px;}
#beer_name{font-weight: bold;}
.beer_img{width:220px; height:230px;}
.my_rating{font-size: 15px;}
</style>
</head>
<body>
<div id="container" >
<!-- 로그인 폼 -->
<c:choose>
	<c:when test="${sessionScope.login_member==null}">
		<jsp:include page="/member/login_form.jsp"/>
	</c:when>
	<c:otherwise>
		<jsp:include page="/member/login_success.jsp"/>
	</c:otherwise>
</c:choose>
<!-- 메뉴 바 -->
<div id="header">
	<jsp:include page="/include/indexTop.jsp"/>
</div>

<!-- 카테고리 검색 메뉴(왼) -->
<div id="search_left_menu">
	<hr size="5" color="gold">
	CATEGORY
	<ul>
		<li><a href="${initParam.rootPath}/liquor/myAssessment.do">내가 평가한 맥주</a></li>
		<li><a href="/Goalbeer/member/member_update_form.jsp">회원정보수정</a></li>
		<li><a href="/Goalbeer/member/delete.do" id="deleteCheck">회원탈퇴</a></li>
	</ul>
</div>

<!-- 검색창 및 검색결과(중앙) -->
<div id="search_content">
	<center>
	<form action="/Goalbeer/member/update.do" method="post">
	
	<table align="center">    
   <tr>
       <td>ID :</td>
       <td><input type="text" id="memberId" name="memberId" value="${sessionScope.login_member.memberId }" maxlength="6" disabled="disabled"/></td>
   </tr>
   <tr>
      <td>PW :</td> 
      <td><input type="password" id="memberPassword" name="memberPassword" value="${sessionScope.login_member.memberPassword}" maxlength="8"/></td>
   </tr>
   <tr>
      <td>이름 :</td> 
      <td><input type="text" id="memberName" name="memberName" value="${sessionScope.login_member.memberName}" disabled="disabled"/></td>
   </tr>
   <tr>
      <td>닉네임 :</td> 
      <td><input type="text" id="nickName" name="nickName" value="${sessionScope.login_member.nickName}" maxlength="6"/><span id="msgNick2"></span></td>
   </tr>
   <tr>
      <td>성별 :</td> 
      <td>
         <c:choose>
            <c:when test="${sessionScope.login_member.gender=='m' }">
               남<input type="radio" name="gender" value="m" disabled="disabled" checked="checked"/>
               여<input type="radio" name="gender" value="f" disabled="disabled"/>      
            </c:when>
            <c:otherwise>
               남<input type="radio" name="gender" value="m" disabled="disabled"/>
                  여<input type="radio" name="gender" value="f" disabled="disabled" checked="checked"/>
             </c:otherwise>
         </c:choose></td>
   </tr>
   <tr>
      <td>전화번호 : </td>   
      <c:if test="${sessionScope.login_member.phoneNumber != null }">
   <c:choose>
      <c:when test="${fn:length(sessionScope.login_member.phoneNumber)==10 }">
         <td><input type="text" size="2" value="${fn:substring(sessionScope.login_member.phoneNumber,0,1) }" maxlength="3"/>
         <input type="text" size="2" value="${fn:substring(sessionScope.login_member.phoneNumber,1,2) }" maxlength="4"/>
         <input type="text" size="2" value="${fn:substring(sessionScope.login_member.phoneNumber,2,3) }" maxlength="4"/></td>
      </c:when>
      <c:when test="${fn:length(sessionScope.login_member.phoneNumber)==11 }">
         <td><input type="text" size="2" name="phone" value="${fn:substring(sessionScope.login_member.phoneNumber,0,3) }" maxlength="3"/>
         <input type="text" size="2" name="phoneNumber1" value="${fn:substring(sessionScope.login_member.phoneNumber,3,7) }" maxlength="4"/>
         <input type="text" size="2" name="phoneNumber2" value="${fn:substring(sessionScope.login_member.phoneNumber,7,12) }" maxlength="4"/></td>
      </c:when>
   </c:choose>
</c:if>

   <tr>       
      <td>Email :</td>
      <c:set var="email" value="${fn:split(sessionScope.login_member.email,'@')}"/><!-- 배열 -->
         <td><input type="text" name="email" value="${email[0] }" size="8" maxlength="13"><!-- 메일 아이디 -->
            <select id="mailAddress" name="mailAddress">   <!-- 메일명 -->
                  
         <c:choose>
            <c:when test="${email[1]=='naver.com' }">
               <option selected="selected">@naver.com</option>
               <option>@hanmail.net</option>
                  <option>@daum.net</option>
                  <option>@gmail.com</option>
            </c:when>
            <c:when test="${email[1]=='hanmail.net' }">
               <option>@naver.com</option>
               <option selected="selected">@hanmail.net</option>
               <option>@daum.net</option>
                  <option>@gmail.com</option>
            </c:when>
            <c:when test="${email[1]=='daum.net' }">
               <option>@naver.com</option>
               <option>@hanmail.net</option>
               <option selected="selected">@daum.net</option>
               <option>@gmail.com</option>
            </c:when>
            <c:when test="${email[1]=='gmail.com' }">
               <option>@naver.com</option>
               <option>@hanmail.net</option>
               <option>@daum.net</option>
               <option selected="selected">@gmail.com</option>
            </c:when> 
         </c:choose>
   </select></td>
   </tr>
   <tr>
      <td><input type="hidden" id="memberGrade" name="memberGrade" value="lev1"/></td>
   </tr>
   <tr align="center">
      <td colspan="2" align="center">
      <input type="hidden" id="memberLeave" name="memberLeave" value="mlt"/>
      <input type="submit" value="수정"/> <input type="reset" value="다시 작성"/>
      </td>
   </tr>
   </table>
   </form>
   
	</center>
</div>

<!-- #링크 LIST (오른) -->
<div id="link_to">LIST<p>
	<c:forEach items="${requestScope.result }" var="beer">
		<a href="#${beer.beerInfoName}">${beer.beerInfoName }</a><br>
	</c:forEach>
</div>

<!-- footer -->
<div id="footer" >
	<jsp:include page="/include/indexBottom.jsp"/>
</div>
</div>
</body>
</html>